﻿using DapperExtensions.Mapper;
using Newtonsoft.Json;

namespace ZilLion.Service.WeChatMall.Domain.Entitys.Orders
{
    public class OrderDetailDto
    {
        /// <summary>
        ///     dddmxhh varchar(15) not null	''	npk 货品明细行号
        /// </summary>
        [JsonProperty("detailsno")]
        public string DetailSno { get; set; }

        /// <summary>
        ///     dddhpid int not null	0			货品id
        /// </summary>
        [JsonProperty("gsid")]
        public long Gsid { get; set; }


        /// <summary>
        ///     dddhpxsmc 品名
        /// </summary>
        [JsonProperty("gsname")]
        public string Gsname { get; set; }


        /// <summary>
        ///     dddjmsl decimal(18,6)	not null	0			数量：数量(界面)
        /// </summary>

        [JsonProperty("qty")]
        public decimal Qty { get; set; }

        /// <summary>
        ///     金额：零售价dddlsj
        /// </summary>
        [JsonProperty("price")]
        public decimal Price { get; set; }


        [JsonProperty("summy")]
        public decimal SumMy { get; set; }
    }


    public class OrderDetailEntity : OrderDetailDto
    {
    }

    public class PrePayOrderDetailEntity : OrderDetailDto
    {
    }

    public class OrderDetailEntityMapper : ClassMapper<OrderDetailEntity>
    {
        public OrderDetailEntityMapper()
        {
            Table("weiscdddt");
            Map(f => f.DetailSno).Column("dddmxhh").Key(KeyType.Assigned);
            Map(f => f.Gsid).Column("dddhpid");
         
            Map(f => f.Qty).Column("dddjmsl");
            Map(f => f.Price).Column("dddlsj");
            Map(f => f.Gsname).Column("dddhpxsmc");
            Map(f => f.SumMy).Column("dddzzcjjexj");
            
        }
    }

    public class PrePayOrderDetailEntityMapper : ClassMapper<PrePayOrderDetailEntity>
    {
        public PrePayOrderDetailEntityMapper()
        {
            Table("weiscdzfdddt");
            Map(f => f.DetailSno).Column("dddmxhh").Key(KeyType.Assigned);
            Map(f => f.Gsid).Column("dddhpid");
            Map(f => f.Qty).Column("dddjmsl");
            Map(f => f.Price).Column("dddlsj");
            Map(f => f.Gsname).Column("dddhpxsmc");
            Map(f => f.SumMy).Column("dddzzcjjexj");
            
        }
    }
}